package VO;

import java.util.ArrayList;

import User.*;

public class GeneralManagerListVO extends UserListVO{
	ArrayList<GeneralManagerVO> GeneralManagerlist = new ArrayList<GeneralManagerVO>();
	String GeneralManagerID="";
	
	public GeneralManagerListVO(){}
	
	public GeneralManagerListVO(ArrayList<GeneralManagerVO>  glist){
		GeneralManagerlist=glist;
		init();
	}
	public GeneralManagerListVO(GeneralManagerList  gemlist){
		for(GeneralManager g: gemlist.getGeneralManagerlist()){
			GeneralManagerVO gemvo=new GeneralManagerVO(g);
			GeneralManagerlist.add(gemvo);
		}
		GeneralManagerID=gemlist.getUserID();
	}
	public GeneralManagerListVO(String gemlistinfo[][]){
		for(String geminfo[]:gemlistinfo){
			GeneralManagerVO gem=new GeneralManagerVO(geminfo);
			GeneralManagerlist.add(gem);
		}
	}
	
	public GeneralManagerListVO(GeneralManagerListVO gemuserlOfAll,String gemidList){
		String[] gidlist=gemidList.split("/");
		if(gemidList.equals("")){
			for(String id:gidlist){
				GeneralManagerVO gemvo=gemuserlOfAll.find(Long.parseLong(id));
				GeneralManagerlist.add(gemvo);
			}
			init();
		}
		
	}
	public void init(){
		for(GeneralManagerVO gem:GeneralManagerlist){
			GeneralManagerID=GeneralManagerID+"/"+gem.getId();
		}
	}
	public GeneralManagerVO find(long id){
		GeneralManagerVO gem=null;
		for(GeneralManagerVO gv:GeneralManagerlist){
			if(gv.getId()==id){
				gem=gv;
				break;
			}
		}
		return gem;
	}
	public ArrayList<GeneralManagerVO> getGeneralManagerlist(){
		return GeneralManagerlist;
	}
	public String getGeneralManagerlid(){
		return GeneralManagerID;
	}

}
